package org.example.kg_back.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.kg_back.PoJo.entity.AirLine;

import java.util.List;


@Mapper
public interface AirLineMapper extends BaseMapper<AirLine> {

	@Select("SELECT adepname,adesname,adeplong,adeplat,adeslong,adeslat,COUNT(*) as count FROM airline_number WHERE adepcode = 'ZSQD' GROUP BY adepname,adesname,adeplong,adeplat,adeslong,adeslat ORDER BY COUNT(*) DESC LIMIT 10;")
	List<AirLine> findBylimit();

	@Select("SELECT COUNT(*) " +
			"FROM (SELECT * " +
				"FROM airline_number " +
				"WHERE adepcode = 'ZSQD' " +
				"GROUP BY adescode) line;"
	)
	Integer findLineCount();
}
